#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>



int main (int argc, char **argv) {

    char command[256];
    char input[64];
    char * filename;
    int ans;
   fprintf(stdout,"Generating protobuf classes...\n");

    if (argc < 2) {
       fprintf(stdout,"Place your file in protobufSRC dir\nenter file name ( in format: filename.proto ) :\n");
       scanf("%s",input);
       filename = input;
    }
    else 
    {
	filename = argv[1];
    }
    
    sprintf(command,"protoc -I=/root/Desktop/Protobuf/protobufSRC --cpp_out=/root/Desktop/Protobuf/protobufDST /root/Desktop/Protobuf/protobufSRC/%s",filename);
    ans = system(command);
    if (ans != 0)
   	fprintf(stdout,"#######Classes Not generated, check your input! #########\nPress any key to finish...");
    else 
	fprintf(stdout,"Classes generated, placed in protobufDST. \nPress any key to finish...");
    getchar();
    getchar();
    return 0;
}
